package  
{
	import net.flashpunk.Entity;
	import net.flashpunk.graphics.Spritemap;
	import net.flashpunk.FP;
	/**
	 * © 2012 TheJavaArcade.com
	 */
	public class Mario extends Entity {
		private var marioSprite:Spritemap = new Spritemap(Assets.MARIO_SPRITE, 12, 16);
		public var level:int;
		
		public function Mario(theLevel:int) {
			level = theLevel;
			marioSprite.add("mario", [0,0,0,1,1,1,0,0,1,1,0,1,0,1,0,1,0], 5, true);
			graphic = marioSprite;
			marioSprite.play("mario");
			type = "mario";
			setHitbox(62, 36, 25, 10);
			x = 1072;
			y = 216;
			layer = 1;
		}
		override public function update():void {
			if (GameEngine.level == level && collide("fracas", x , y)) {
				GameEngine.marioDialogue.visible = true;
				GameEngine.marioDialogue.x = (x +8) - (GameEngine.marioDialogue.theText.width / 2);
				GameEngine.marioDialogue.y = y - 30;
			}else {
				GameEngine.marioDialogue.visible = false;
			}
		}
		
	}

}